home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / dpkg / info / hplip.postinst < prev    next >
Encoding:
Text File  |  2009-04-14  |  3.4 KB  |  110 lines

  1. #! /bin/sh
  2. # postinst script for hplip
  3. # $Id: hplip.postinst,v 1.1 2005/10/15 21:39:04 hmh Exp $
  4. #
  5. # see: dh_installdeb(1)
  6.  
  7. set -e
  8.  
  9. # summary of how this script can be called:
  10. #        * <postinst> `configure' <most-recently-configured-version>
  11. #        * <old-postinst> `abort-upgrade' <new version>
  12. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  13. #          <new-version>
  14. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  15. #          <failed-install-package> <version> `removing'
  16. #          <conflicting-package> <version>
  17. # for details, see http://www.debian.org/doc/debian-policy/ or
  18. # the debian-policy package
  19. #
  20. # quoting from the policy:
  21. #     Any necessary prompting should almost always be confined to the
  22. #     post-installation script, and should be protected with a conditional
  23. #     so that unnecessary prompting doesn't happen if a package's
  24. #     installation fails and the `postinst' is called with `abort-upgrade',
  25. #     `abort-remove' or `abort-deconfigure'.
  26.  
  27. case "$1" in
  28.     configure)
  29.     # add hplip system user (requires adduser >= 3.34)
  30.     # don't muck around with this unless you KNOW what you're doing
  31.     echo "Creating/updating hplip user account..."
  32.     adduser --system --ingroup lp --home /var/run/hplip \
  33.         --gecos "HPLIP system user" --shell /bin/false \
  34.         --quiet --disabled-password hplip || {
  35.       # adduser failed. Why?
  36.       if getent passwd hplip >/dev/null ; then
  37.          echo "Non-system user hplip found. I will not overwrite a non-system" >&2
  38.          echo "user.  Remove the user and reinstall hplip." >&2
  39.          exit 1
  40.       fi
  41.       # unknown adduser error, simply exit
  42.       exit 1
  43.     }
  44.  
  45.     for i in /var/run/hplip
  46.     do
  47.         if ! dpkg-statoverride --list $i > /dev/null
  48.         then
  49.             dpkg-statoverride --update --add hplip root 755 $i
  50.         fi
  51.     done
  52.  
  53.  
  54.     # Remove shutdown and reboot links; this init script does not need them.
  55.     if dpkg --compare-versions "$2" lt "1.7.3-0ubuntu4"; then
  56.         update-rc.d -f hplip remove
  57.     fi
  58.  
  59.     # Fix PPD file paths in /etc/hp/hplip.conf to make sure that hp-setup
  60.     # finds the fax PPDs
  61.     perl -p -i -e 's:^(\s*ppd=).*$:\1/usr/share/ppd/hpijs/HP:' /etc/hp/hplip.conf
  62.     perl -p -i -e 's:^(\s*ppdbase=).*$:\1/usr/share/ppd/hpijs:' /etc/hp/hplip.conf
  63.  
  64.     ;;
  65.  
  66.     abort-upgrade|abort-remove|abort-deconfigure)
  67.     ;;
  68.  
  69.     *)
  70.         echo "postinst called with unknown argument \`$1'" >&2
  71.         exit 1
  72.     ;;
  73. esac
  74.  
  75. # dh_installdeb will replace this with shell code automatically
  76. # generated by other debhelper scripts.
  77.  
  78. # Automatically added by dh_installmenu
  79. if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
  80.     update-menus
  81. fi
  82. # End automatically added section
  83. # Automatically added by dh_installudev
  84. if [ "$1" = configure ]; then
  85.     if [ -e "/etc/udev/hplip.rules" ]; then
  86.         echo "Preserving user changes to /lib/udev/rules.d/40-hplip.rules ..."
  87.         if [ -e "/lib/udev/rules.d/40-hplip.rules" ]; then
  88.             mv -f "/lib/udev/rules.d/40-hplip.rules" "/lib/udev/rules.d/40-hplip.rules.dpkg-new"
  89.         fi
  90.         mv -f "/etc/udev/hplip.rules" "/lib/udev/rules.d/40-hplip.rules"
  91.     fi
  92. fi
  93. # End automatically added section
  94. # Automatically added by dh_installudev
  95. if [ "$1" = configure ]; then
  96.     if [ -e "/etc/udev/rules.d/50-hplip.rules" ]; then
  97.         echo "Preserving user changes to /etc/udev/rules.d/40-hplip.rules ..."
  98.         mv -f "/etc/udev/rules.d/50-hplip.rules" "/etc/udev/rules.d/40-hplip.rules"
  99.     fi
  100. fi
  101. # End automatically added section
  102. # Automatically added by dh_makeshlibs
  103. if [ "$1" = "configure" ]; then
  104.     ldconfig
  105. fi
  106. # End automatically added section
  107.  
  108.  
  109. exit 0
  110.